package com.my.zl.console.controller.visualEdit;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.my.zl.common.dto.ReqDTO;
import com.my.zl.common.dto.ResDTO;
import com.my.zl.common.dto.advancedQuery.PageQueryDTO;
import com.my.zl.console.common.aop.LogAnnotation;
import com.my.zl.console.controller.base.BaseController;
import com.my.zl.console.entity.visualEdit.ZlHtmlDesign;
import com.my.zl.console.dto.visualEdit.htmlDesign.ReqHtmlDesignAddDTO;
import com.my.zl.console.dto.visualEdit.htmlDesign.ReqHtmlDesignDelDTO;
import com.my.zl.console.dto.visualEdit.htmlDesign.ReqHtmlDesignEditDTO;
import com.my.zl.console.dto.visualEdit.htmlDesign.ReqHtmlDesignQueryDTO;
import com.my.zl.console.dto.visualEdit.htmlDesign.ReqHtmlDesignDetailDTO;
import com.my.zl.console.dto.visualEdit.htmlDesign.ReqHtmlDesignStateDTO;
import com.my.zl.console.dto.visualEdit.htmlDesign.ResHtmlDesignAddDTO;
import com.my.zl.console.dto.visualEdit.htmlDesign.ResHtmlDesignDelDTO;
import com.my.zl.console.dto.visualEdit.htmlDesign.ResHtmlDesignEditDTO;
import com.my.zl.console.dto.visualEdit.htmlDesign.ResHtmlDesignQueryDTO;
import com.my.zl.console.dto.visualEdit.htmlDesign.ResHtmlDesignDetailDTO;
import com.my.zl.console.service.visualEdit.IHtmlDesignService;
import com.my.zl.console.dto.visualEdit.htmlDesign.ResHtmlDesignStateDTO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 在线页面
 * @author ZL
 */
@Api(value="在线页面",tags ="在线页面")
@RestController
@RequestMapping("/api/autocode/htmlDesign")
public class HtmlDesignController extends BaseController {

    @Autowired
    private IHtmlDesignService htmlDesignService;
    
    /**
     * 查询
     */
    @ApiOperation(value="在线页面-查询")
    @RequestMapping(value="/list", method = RequestMethod.GET)
    public ResDTO<ResHtmlDesignQueryDTO> listHtmlDesign(ReqHtmlDesignQueryDTO reqInfo,PageQueryDTO page) throws Exception{
        ResHtmlDesignQueryDTO data = htmlDesignService.queryHtmlDesignList(reqInfo,page);
        return successDATA(data);
    }
    
   /**
     * 详情
     */
    @ApiOperation(value="在线页面-详情")
    @RequestMapping(value="/detail", method = RequestMethod.GET)
    public ResDTO<ResHtmlDesignDetailDTO> detailHtmlDesign(ReqHtmlDesignDetailDTO reqInfo) throws Exception{
        ResHtmlDesignDetailDTO data = htmlDesignService.queryHtmlDesignDetail(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 新增
     */
    @ApiOperation(value="在线页面-新增")
    @RequestMapping(value="/add", method = RequestMethod.POST)
    public ResDTO<ResHtmlDesignAddDTO> addHtmlDesign(@RequestBody ReqDTO<ReqHtmlDesignAddDTO> reqInfo) throws Exception{
        ResHtmlDesignAddDTO data = htmlDesignService.insertHtmlDesignInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 编辑
     */
    @ApiOperation(value="在线页面-编辑")
    @RequestMapping(value="/edit", method = RequestMethod.POST)
    public ResDTO<ResHtmlDesignEditDTO> editHtmlDesign(@RequestBody ReqDTO<ReqHtmlDesignEditDTO> reqInfo) throws Exception{
        ResHtmlDesignEditDTO data = htmlDesignService.updateHtmlDesignInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 删除
     */
    @ApiOperation(value="在线页面-删除")
    @RequestMapping(value="/del", method = RequestMethod.POST)
    public ResDTO<ResHtmlDesignDelDTO> delHtmlDesign(@RequestBody ReqDTO<ReqHtmlDesignDelDTO> reqInfo) throws Exception{
        ResHtmlDesignDelDTO data = htmlDesignService.deleteHtmlDesignInfo(reqInfo);
        return successDATA(data); 
    }
    
    /**
     * 状态更新
     */
    @ApiOperation(value="在线页面-状态更新")
    @RequestMapping(value="/state", method = RequestMethod.POST)
    public ResDTO<ResHtmlDesignStateDTO> stateHtmlDesign(@RequestBody ReqDTO<ReqHtmlDesignStateDTO> reqInfo) throws Exception{
        ResHtmlDesignStateDTO data = htmlDesignService.updateHtmlDesignState(reqInfo);
        return successDATA(data); 
    }
    
    
}